package com.mall.goods.service.impl;

import java.util.List;
import com.mall.common.utils.DateUtils;
import com.mall.goods.mapper.GoodsRecommendMapper;
import com.mall.goods.model.dto.GoodsRecommendDto;
import com.mall.goods.model.vo.GoodsRecommendVo;
import com.mall.goods.service.IGoodsRecommendService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 商品推荐Service业务层处理
 */
@Service
public class GoodsRecommendServiceImpl implements IGoodsRecommendService
{
    @Resource
    private GoodsRecommendMapper goodsRecommendMapper;

    /**
     * 查询商品推荐
     */
    @Override
    public GoodsRecommendVo selectGoodsRecommendById(Long id)
    {
        return goodsRecommendMapper.selectGoodsRecommendById(id);
    }

    /**
     * 查询商品推荐列表
     */
    @Override
    public List<GoodsRecommendVo> selectGoodsRecommendList(GoodsRecommendDto goodsRecommendDto)
    {
        return goodsRecommendMapper.selectGoodsRecommendList(goodsRecommendDto);
    }

    /**
     * 新增商品推荐
     */
    @Override
    public int insertGoodsRecommend(GoodsRecommendDto goodsRecommendDto)
    {
        goodsRecommendDto.setCreateTime(DateUtils.getNowDate());
        return goodsRecommendMapper.insertGoodsRecommend(goodsRecommendDto);
    }

    /**
     * 修改商品推荐
     */
    @Override
    public int updateGoodsRecommend(GoodsRecommendDto goodsRecommendDto)
    {
        goodsRecommendDto.setUpdateTime(DateUtils.getNowDate());
        return goodsRecommendMapper.updateGoodsRecommend(goodsRecommendDto);
    }

    /**
     * 批量删除商品推荐
     */
    @Override
    public int deleteGoodsRecommendByIds(Long[] ids)
    {
        return goodsRecommendMapper.deleteGoodsRecommendByIds(ids);
    }

    /**
     * 删除商品推荐信息
     */
    @Override
    public int deleteGoodsRecommendById(Long id)
    {
        return goodsRecommendMapper.deleteGoodsRecommendById(id);
    }
}
